<template>
	<el-drawer title="试题详情" v-model="visible" :size="800" destroy-on-close @closed="$emit('closed')">
		<el-container v-loading="loading">
			<el-main>
				<el-form :model="form"  ref="dialogForm" label-width="100px" label-position="left">
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="排序号" prop="sortNo">{{form.sortNo}}</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="试题类型" prop="examType">
								<el-tag v-if="form.examType=='0'">单选</el-tag>
								<el-tag v-if="form.examType=='1'">多选</el-tag>
								<el-tag v-if="form.examType=='2'">简述</el-tag>
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="试题题干" prop="title">{{form.title}}
					</el-form-item>
					<div>
						<el-form-item label="试题子项" prop="list" v-if="form.examType!='2'">
							<div v-for="(item,index) in questionsList" :key="index" style="width: 100%">
								({{index+1}})
								{{item.optValue}}、{{item.childTitle}}
							</div>
						</el-form-item>
					</div>
					<el-row :gutter="24">
						<el-col :lg="12">
							<el-form-item label="答案" prop="answer">{{form.answer}}
							</el-form-item>
						</el-col>
						<el-col :lg="12">
							<el-form-item label="分值" prop="grade"><span style="color: red">{{form.grade}}</span>/分
							</el-form-item>
						</el-col>
					</el-row>
					<el-form-item label="备注">{{form.remark}}
					</el-form-item>
				</el-form>
				<el-footer style="text-align: center;">
					<el-button @click="visible=false">关闭</el-button>
				</el-footer>
			</el-main>
		</el-container>
	</el-drawer>
</template>

<script>
export default {
	emits: ['success', 'closed'],
	components: {
	},
	data() {
		return {
			loading: false,
			questionsList:[],
			form: {
				recordId: '',
				title: '',
				sortId: '',
				questionsList: '',
				sortNo: '0',
				examType: "0",
				answer: '',
				grade: '',
				remark: '',
			},
			visible: false,
			isSaveing: false,
		}
	},
	mounted() {

	},
	methods: {
		//显示
		open(model) {
			this.model = model;
			this.visible = true;
			return this;
		},
		//表单注入数据
		setData(data) {
			this.form.recordId = data.recordId
			this.form.title = data.title
			this.form.sortId = data.sortId
			this.form.questionsList = data.questionsList
			this.form.sortNo = data.sortNo
			this.form.examType = data.examType
			this.form.answer = data.answer
			this.form.grade = data.grade
			this.form.remark = data.remark
			if(data.questionsList!=null)
			{
				this.questionsList = JSON.parse(data.questionsList);
			}
		},
	}
}
</script>

<style>
</style>
